home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SPACE 2
/
SPACE - Library 2 - Volume 1.iso
/
apps
/
186
/
applic
/
initpntr.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1987-10-13
|
2KB
|
70 lines
{$S1} {1 K stack}
PROGRAM InitializePrinter;
{To minimize the size of the .PRG, compile with debug off, stack checking
off, and range checking off.}
CONST
FileName = 'A:\PRTSTUPA.INF';
TYPE
T2 = PACKED ARRAY [1..80] OF char;
T1 = PACKED ARRAY [1..512] OF char;
VAR
junk : long_integer;
f : T2;
Handle : integer;
Count : long_integer;
Buffer : T1;
NBytes : long_integer;
i : integer;
ch : byte;
S : string;
ch2 : char;
j : long_integer;
FUNCTION Out(x : byte) : long_integer;
GEMDOS( $05 );
FUNCTION Open
(VAR FilePtr : T2;
mode : integer)
: integer;
GEMDOS( $3D);
FUNCTION Read
(Handle : integer;
count : long_integer;
VAR buf : T1)
: long_integer;
GEMDOS( $3F);
FUNCTION ConIn : long_integer;
GEMDOS ($01);
BEGIN {initializeprinter}
S := FileName;
FOR i := 1 TO LENGTH(S)DO
F[i] := S[i];
F[LENGTH(S) + 1] := CHR(0);
WriteLn('Initializing printer.');
WriteLn('You have 5 seconds to provide a new');
WriteLn('last character for the set up file name. [A - Z]');
{5 second delay}
j := 1;
REPEAT
j := j + 1;
UNTIL j > 388500;
IF KeyPress THEN
BEGIN
ReadLn(ch2);
F[11] := ch2;
END;
Handle := Open(F,0);
IF Handle > 5 THEN
BEGIN
NBytes := Read(Handle,512,Buffer);
{Send set up commands to printer}
REWRITE(Output,'PRN:');
FOR i := 1 TO INT(NBytes) DO
Write(Output,Buffer[i]);
END;
END.